
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from rest_framework_jwt.views import obtain_jwt_token

from . import views

urlpatterns = [


    #签发JWT的网站路由
# cons.apis + '/authorizations/'
    #后端登陆
    url(r'^meiduo_admin/authorizations/$', obtain_jwt_token),

    #统计月累计日增加用户
    url(r'^meiduo_admin/statistical/month_increment/$', views.UserMonthCountView.as_view()),

    #统计用户总数
    url(r'^meiduo_admin/statistical/total_count/$', views.UserTotalCountView.as_view()),

    #日增用户
    url(r'^meiduo_admin/statistical/day_increment/$', views.UserDayCountView.as_view()),

    #日活跃
    url(r'^meiduo_admin/statistical/day_active/$', views.UserActiveCountView.as_view()),
    #日下单
    url(r'^meiduo_admin/statistical/day_orders/$', views.UserOrderCountView.as_view()),
    #日分类商品访问量
    url(r'^meiduo_admin/statistical/goods_day_views/$', views.GoodsDayView.as_view()),
    #查询用户get和新增用户post
    url(r'^meiduo_admin/users/$', views.UserListView.as_view()),


    #SKU新增图片获取所有sku 的id name
    url(r'^meiduo_admin/skus/simple/$', views.ImageAdd_get_skuView.as_view()),


    #新增商品
    url(r'^meiduo_admin/skus/categories/$', views.AddCategoryView.as_view()),
    #新增商品表中的SPU信息
    url(r'^meiduo_admin/goods/simple/$', views.AddSPUView.as_view()),
    #新增商品表中的SPU规格信息
    url(r'^meiduo_admin/goods/(?P<pk>\d+)/specs/$', views.ADDSPUoptionsView.as_view()),

    #新增SPU表中的一级分类
    url(r'^meiduo_admin/goods/channel/categories/$', views.SPU_category.as_view()),
    #新增SPU表中的二级分类
    url(r'^meiduo_admin/goods/channel/categories/(?P<pk>\d+)/$', views.SPU_category2.as_view()),
    #新增SPU表中的品牌
    url(r'^meiduo_admin/goods/brands/simple/$', views.ADD_SPU_brand.as_view()),

    #规格选项管理中新增规格
    url(r'^meiduo_admin/goods/specs/simple/$', views.ADD_Option.as_view()),

    # 频道管理中 新增频道中的频道组信息!!
    url(r'^meiduo_admin/goods/channel_types/$', views.channel_types.as_view()),

    #频道管理中 新增频道中的一级分类
    url(r'^meiduo_admin/goods/categories/$', views.Goods_Categories.as_view()),






    #获取权限类型
    url(r'^meiduo_admin/permission/content_types/$', views.ContentTypeListAPIView.as_view()),
    #分组中获取权限表数据
    url(r'^meiduo_admin/permission/simple/$', views.GroupContentListAPIView.as_view()),
    #获取管理员信息修改中的用户组
    url(r'^meiduo_admin/permission/groups/simple/$', views.AdminGroupListAPIView.as_view()),
]
#注册一个视图集写一个对象
#图片
router = DefaultRouter()
router.register(r'meiduo_admin/skus/images',views.ImageViewSet,base_name='images')
urlpatterns += router.urls
#sku
router = DefaultRouter()
router.register(r'meiduo_admin/skus',views.SKUModelViewSet,base_name='skus')
urlpatterns += router.urls
#规格表
router = DefaultRouter()
router.register(r'meiduo_admin/goods/specs',views.SPU_specification_ViewSet,base_name='specs')
urlpatterns += router.urls
#频道管理
router = DefaultRouter()
router.register(r'meiduo_admin/goods/channels',views.ChannelsViewSet,base_name='channels')
urlpatterns += router.urls
#品牌管理
router = DefaultRouter()
router.register(r'meiduo_admin/goods/brands',views.Goods_Brands,base_name='permission_admins')
urlpatterns += router.urls
#spu
router = DefaultRouter()
router.register(r'meiduo_admin/goods',views.SPUModelViewSet,base_name='spus')
urlpatterns += router.urls
#规格选项表
router = DefaultRouter()
router.register(r'meiduo_admin/specs/options',views.specification_options_ViewSet,base_name='specs_options')
urlpatterns += router.urls
#订单
router = DefaultRouter()
router.register(r'meiduo_admin/orders',views.OrderViewSet,base_name='orders')
urlpatterns += router.urls
#权限
router = DefaultRouter()
router.register(r'meiduo_admin/permission/perms',views.PermissionViewSet,base_name='permission')
urlpatterns += router.urls
#用户组管理
router = DefaultRouter()
router.register(r'meiduo_admin/permission/groups',views.GroupViewSet,base_name='groups')
urlpatterns += router.urls
#管理员用户列表
router = DefaultRouter()
router.register(r'meiduo_admin/permission/admins',views.AdminView,base_name='permission_admins')
urlpatterns += router.urls

